// 业务对象api - PLM
import request from '@/utils/request'

/**
 * 业务对象列表
 */
export function getFieldAPI() {
	return request({
		url: '/plm/field/getField',
		method: 'get'
	})
}

/**
 *  业务对象字段列表
 * @param {String} params modelClassId
 * @returns
 */
export function getListAPI(params) {
	return request({
		url: '/plm/field/getList',
		method: 'get',
		params
	})
}

/**
 * 业务对象及其字段
 * @param {String} params id
 * @returns
 */
export function modelFieldAPI(params) {
	return request({
		url: '/plm/field/modelField',
		method: 'get',
		params
	})
}

/**
 * 新增业务对象
 * @param {*} data
 * @returns
 */
export function addModelAPI(data) {
	return request({
		url: '/plm/field/addModel',
		method: 'post',
		data
	})
}

/**
 * 新增业务对象字段
 * @param {*} data
 * @returns
 */
export function addFieldAPI(data) {
	return request({
		url: '/plm/field/addField',
		method: 'post',
		data
	})
}

/**
 * 更新业务对象
 * @param {*} data
 * @returns
 */
export function changeModelAPI(data) {
	return request({
		url: '/plm/field/changeModel',
		method: 'put',
		data
	})
}

/**
 * 更新业务对象字段
 * @param {*} data
 * @returns
 */
export function changeFieldAPI(data) {
	return request({
		url: '/plm/field/changeField',
		method: 'put',
		data
	})
}

/**
 * 删除业务对象
 * @param {*} params
 * @returns
 */
export function deleteModelAPI(params) {
	return request({
		url: '/plm/field/deleteModel',
		method: 'delete',
		params
	})
}

/**
 * 删除业务对象字段
 * @param {*} params
 * @returns
 */
export function deleteFieldAPI(params) {
	return request({
		url: '/plm/field/deleteField',
		method: 'delete',
		params
	})
}

// 获取所有规则
export function allRuleAPI(params) {
	return request({
		url: '/plm/field/allRule',
		method: 'get',
		params
	})
}

// 更改自动生成规则
export function changeRuleAPI(data) {
	return request({
		url: '/plm/field/changeRule',
		method: 'post',
		data
	})
}
